import { Controller, Get, Post, Body, Param, ParseIntPipe } from '@nestjs/common';
import { GoodService } from '../service/good.service';
import { CreateGoodDto, GoodResponseDto } from '../dto/good.dto';

@Controller('good')
export class GoodController {
  constructor(private readonly goodService: GoodService) {}

  @Get()
  findAll(): GoodResponseDto[] {
    return this.goodService.findAll();
  }

  @Get(':id')
  findOne(@Param('id', ParseIntPipe) id: number): GoodResponseDto {
    return this.goodService.findOne(id);
  }

  @Post()
  create(@Body() createGoodDto: CreateGoodDto): GoodResponseDto {
    return this.goodService.create(createGoodDto);
  }
}